<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>管理员登录</title>
    <import file="cpanel.boot" basepath="__PUBLIC__"/>
</head>
<body>
	<div id="dlg" class="easyui-dialog" title="管理员登录" closable="false" draggable="false" data-options="buttons: '#dlg-buttons'" style="width: 400px; height: 220px; padding: 20px;">
		<form id="login-form" method="post">
			<table>
				<tr>
					<td>登录名：</td>
	    			<td colspan="2"><input class="easyui-validatebox" type="text" name="user_name" size="25" data-options="required:true,missingMessage:'请输入登录名'"></td>
				</tr>
				<tr>
					<td>密 &nbsp;码：</td>
	    			<td colspan="2"><input class="easyui-validatebox" type="text" name="password" size="25" data-options="required:true,missingMessage:'请输入密码'"></td>
				</tr>
				<tr>
					<td>验证码：</td>
	    			<td><input class="easyui-validatebox" name="verify_code" size="8" data-options="required:true,missingMessage:'请输入验证码'"></td>
	    			<td><img src="{:U('/cpanel/index/freshVerify')}" width="110" height="23"  onclick="verifyFresh(this)" align="absbottom"></td>
				</tr>
			</table>
		</form>
	</div>
	<div id="dlg-buttons">
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="userLogin()">登录</a>
		<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-reload" onclick="location.href='{:U('/')}'">返回首页</a>
	</div>
	<script type="text/javascript">
	function userLogin(){
        var options = {
            url: "{:U('/cpanel/index/login')}",
            type: 'post',
            dataType: 'json',
            data: $("#login-form").serialize(),
            success: function (data) {
                if (data.status == 0){
                    alert(data.info);
                    return false;
                }
                closeandopen("{:U('index')}");
            }
        };
        $.ajax(options);
        return false;
	}
	
	var src = '';
    var verifyFresh = function(e){
        src = src == '' ? e.src : src;
        e.src = src + '?t=' + Math.random();
    }
	</script>
</body>
</html>